<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
	<style type="text/css">
		table{
			width: 600px;
			margin: auto;
			border-collapse: collapse;
			border: black 1px solid;
		}
		td{
			border: black 1px solid;
			padding: 10px;
		}
		th{
			border: black 1px solid;
			padding: 10px;
		}
	</style>
<body>
	<c:if test="${not empty movieList}">
		<table id="table_1">
			<caption>
				<h1>电影</h1>
			</caption>
			<tr id="tr_1">
				<th>编号</th>
				<th>电影名</th>
				<th>上架时间</th>
				<th>下架时间</th>
				<th>票价</th>
				<th>操作</th>
			</tr>
			<c:forEach var="movie" items="${movieList}">
				<tr>
					<td>${movie.id}</td>
					<td>${movie.name}</td>
		   			<td>${movie.onShelfDate}</td>
		   			<td>${movie.offShelfDate}</td>
		   			<td>${movie.ticketPrice}</td>
		   			<td>
		   				<a href= "${pageContext.request.contextPath}/cinema?action=addShow&mid=${movie.id}">添加放映</a>
		   			</td>
				</tr>
			</c:forEach>
		</table>
		<font>
			<center>
				${moviePage.currentPage}/${moviePage.totalPage}页&emsp;
				<a href="${pageContext.request.contextPath}/cinema?action=page&page=1">首页</a>&emsp;
				<a href="${pageContext.request.contextPath}/cinema?action=page&page=${moviePage.currentPage-1}">上一页</a>&emsp;
				<a href="${pageContext.request.contextPath}/cinema?action=page&page=${moviePage.currentPage+1}">下一页</a>&emsp;
				<a href="${pageContext.request.contextPath}/cinema?action=page&page=${moviePage.totalPage}">末页</a>
			</center>
		</font>
	</c:if>
	<c:if test="${empty movieList}">
		<table>
			<caption>
				<h1>电影棚空空如也</h1>
			</caption>
			<tr>
				<th>编号</th>
				<th>电影名</th>
				<th>上架时间</th>
				<th>下架时间</th>
				<th>票价</th>
				<th>操作</th>
			</tr>
		</table>
	</c:if>
</body>
</html>